package game.movie
{
	import game.constHlp.PoolType;
	import game.constHlp.RoleActions;
	import game.view.Bullet;
	
	import laya.utils.Pool;

	/**
	 * 游戏角色动画基类 包括敌人和主角
	 *@date 2017-2-20 下午5:46:50
	 *@author zhouhonghui
	 */
	public class GRoleBaseMovie extends BaseMovie
	{
		protected var _action:int;
		public function GRoleBaseMovie()
		{
			super();
		}
		
		public function shoot():Bullet
		{
			var b:Bullet = Pool.getItemByClass(PoolType.BULLET,Bullet);
			b.seType(1);		
			setBulletPos(b);
			return b;
		}
		
		
		/**
		 * 设置子弹的初始坐标 
		 * @param b
		 * 
		 */		
		protected function setBulletPos(b:Bullet):void
		{
			b.x = this.x; 
			b.y = this.y-25; 
		}
		/**
		 * 设置动作  
		 * 
		 */		
		protected function setAction(nameKey:String,action:int):void
		{
			var obj:Object = RoleActions.getActionInf(nameKey,action);
			if(obj)
			{
				var c:int = obj.count;
				var urlFix:String = obj.urlFix;
				switch(action)
				{
					case RoleActions.FLY:
						urlFix+="fly";
						break;
					case RoleActions.DOWN:
						urlFix+="down";
						break;
					case RoleActions.HIT:
						urlFix+="hit";
						break;
				}
				urlFix = "war/"+urlFix;
				setSourceRes(urlFix,c);
			}			
		}

		public function get action():int
		{
			return _action;
		}

		public function set action(value:int):void
		{
			_action = value;
		}
		
		
		
	}
}